<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link href="skin/base.css" type="text/css" rel="stylesheet" />
<link href="skin/form.css" type="text/css" rel="stylesheet" />
<link href="skin/btn.css" type="text/css" rel="stylesheet" />
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/config.js"></script>
<script src="js/common.js"></script>
</head>
<body ontouchstart>
<div id="main">
  <div id="content">
    <div class="form">
    	<div class="items">
    		<div class="item box box-hor">
            	<div class="label">UID:</div>
            	<div class="txt ninput">
            		<span id="uid"><script>document.write(localStorage['u_id']);</script></span>
				</div>
            </div>
			<div class="item box box-hor">
            	<div class="label">用户名:</div>
            	<div class="txt ninput">
            		<span id="mobile">加载中...</span>
				</div>
            </div>
			<div class="item box box-hor">
            	<div class="label">昵称:</div>
            	<div class="txt">
            		<input type="text" id="nickname" name="nickname" maxlength="6" placeholder="请输入昵称" value="" />
				</div>
            </div>
			<div class="item box box-hor">
            	<div class="label">手机号:</div>
            	<div class="txt ninput">
            		<span id="mobile">绑定手机号</span>
				</div>
            </div>
			<div class="item box box-hor">
            	<div class="label">邮箱:</div>
            	<div class="txt ninput">
            		<span id="email"></span>
				</div>
            </div>
			<div class="item box box-hor">
            	<div class="label">注册时间:</div>
            	<div class="txt ninput">
            		<span id="regdate">加载中...</span>
				</div>
            </div>
        </div>
		
      <div class="btn">
        <div class="button" ontouchstart="zy_touch('down')" onclick="Save()">保存修改</div>
      </div>
     
    </div>
  </div>
</div>
</body>
<script>
    	zy_init();
		var	Saves=false;
		
		function Save(){
			if(Saves){
				return false;
			}
			if (!c_l()) {
				gologin();
				return false;
			}
			
			var url=app_path+'index.php?m=iapp&c=user&a=useredit&userid='+localStorage['u_id']+'&acctoken='+localStorage['u_acctoken'];
			uexXmlHttpMgr.open('2','post',url,"8000");
			uexXmlHttpMgr.setPostData('2','0','nickname',$$('nickname').value);
			uexXmlHttpMgr.send('2');
			Saves=true;
		}
		
		function getMain(){
			uexWindow.toast(1, 5, '加载中...', 0);
			var url=app_path+'index.php?m=iapp&c=user&a=userdata&userid='+localStorage['u_id']+'&acctoken='+localStorage['u_acctoken'];
			uexXmlHttpMgr.open('1','post',url,"8000");
			uexXmlHttpMgr.send('1');
		}
		
        window.uexOnload = function(type){
            if (!type){
				uexWindow.setBounce("1");
				uexXmlHttpMgr.onData = function(opId, status, data){
					data=JSON.parse(data);			
					if (opId == 2) {
						Saves=false;
						if (status == 1) {
							if(data['success']=='OK'){						
								uexWindow.toast("0","5",'保存成功',1000);
							}else if(data['success']=='NOLOGIN'){
								gologin();
							}else{
								uexWindow.toast("0","5",data['msg'],1000);
							}
						}else if(status==-1){
							uexWindow.toast("0","5",'保存超时',1000);
						}
					}else if (opId == 1) {
						uexWindow.closeToast();
						if(data['success']=='OK'){
							var u=data['data'];
							if(u['username']){
								$$('mobile').innerHTML=u['username'];
							}
							if(u['nickname']){
								$$('nickname').value=u['nickname'];
							}
							if(u['mobile']){
								$$('mobile').innerHTML=u['mobile'];
							}
							if(u['email']){
								$$('email').innerHTML=u['email'];
							}
							if(u['regdate']){
								$$('regdate').innerHTML=u['regdate'];
							}
						}else if(data['success']=='NOLOGIN'){
							gologin();
						}else{
							uexWindow.toast("0","5",data['msg'],1000);
						}
					}
				}
				getMain();
			}
        }
    </script>
</html>